package com.chengwei.ch.busdemo.adapter;

import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.chengwei.ch.busdemo.APP;
import com.chengwei.ch.busdemo.R;

import java.util.List;

public class SettingAdapter extends BaseQuickAdapter<String, BaseViewHolder> {

    private List<String> list;

    public SettingAdapter(int layoutResId, List<String> list) {
        super(layoutResId, list);
        this.list = list;
    }

    @Override
    protected void convert(BaseViewHolder helper, String s) {
        helper.setText(R.id.tvNameItemSetting, s);
        if (helper.getPosition() == 2) {
            helper.setImageDrawable(R.id.ivSwitchSetting, APP.app.getDrawable(R.drawable.icon_check_box_normal));
        }
        if (helper.getPosition() == list.size() - 1) {
            helper.getView(R.id.tvActivationSetting).setVisibility(View.VISIBLE);
        } else helper.getView(R.id.tvActivationSetting).setVisibility(View.GONE);
        helper.addOnClickListener(R.id.tvActivationSetting);
    }
}
